home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / mc51bugs / q32801 < prev    next >
Text File  |  1988-09-23  |  904b  |  39 lines

  1. Q32801 CTRL+Z (^Z) Does Not Clear Reading from stdin
  2. C Compiler
  3. 5.10   | 5.10
  4. MS-DOS | OS/2
  5.  
  6. Summary:
  7.  
  8. The program below reads everything correctly the first time through
  9. the loop; however, it fails on subsequent readings unless the file is
  10. closed and reopened or freopen is called.
  11.  
  12. Microsoft has confirmed this to be a problem in Version 5.10 of the C
  13. compiler. We are researching this problem and will post new
  14. information as it becomes available.
  15.  
  16. More Information:
  17.  
  18. The following code demonstrates this problem:
  19.  
  20. #include <stdio.h>
  21.  
  22. main()
  23. {
  24.   char buffer[80];
  25.  
  26.   for (;;) {
  27.      flushall();
  28.      fflush(stdin);
  29.      clearerr(stdin);
  30.      fprintf(stdout,"Let's enter some text (^Z to stop, ^C to abort)\n");
  31.      while (fgets(buffer,80,stdin) != NULL) {
  32.              fputs(buffer,stdout);
  33.           }
  34.         }
  35. }
  36.  
  37. Keywords:  buglist5.10
  38. Updated  88/09/24 08:09
  39.